package com.grandprixsw.evmsmobile;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TabHost;

public class TabWidget extends TabActivity {
	private final int tabHeight = 75;

	public void onCreate(Bundle savedInstanceState) {
	    super.onCreate(savedInstanceState);
	    setContentView(R.layout.tab_widget);

	    TabHost tabHost = getTabHost();  // The activity TabHost
	    TabHost.TabSpec spec;  // Resusable TabSpec for each tab
	    Intent intent;  // Reusable Intent for each tab

	    // Create an Intent to launch an Activity for the tab (to be reused)
	    intent = new Intent().setClass(this, MainActivity.class);

	    // Initialize a TabSpec for each tab and add it to the TabHost
	    spec = tabHost.newTabSpec("evms").setIndicator("EVMS").setContent(intent);
	    tabHost.addTab(spec);
	    tabHost.getTabWidget().getChildAt(0).getLayoutParams().height = tabHeight;

	    // Do the same for the other tabs
	    intent = new Intent().setClass(this, DefinitionActivity.class);
	    spec = tabHost.newTabSpec("definitions").setIndicator("Definitions").setContent(intent);
	    tabHost.addTab(spec);
	    tabHost.getTabWidget().getChildAt(1).getLayoutParams().height = tabHeight;

	    // Do the same for the other tabs
	    intent = new Intent().setClass(this, ProjectsActivity.class);
	    spec = tabHost.newTabSpec("projects").setIndicator("Projects").setContent(intent);
	    tabHost.addTab(spec);
	    tabHost.getTabWidget().getChildAt(2).getLayoutParams().height = tabHeight;

	    tabHost.setCurrentTab(0);
	}
}
